#define _CRT_SECURE_NO_WARNINGS 1
class Solution {
public:

    string formatString(string str, vector<char>& arg) {
        string ret;
        int n = 0;
        for (int i = 0; i < str.size();)
        {
            if (str[i] == '%')
            {
                ret.push_back(arg[n++]);
                i += 2;
            }
            else
            {
                ret.push_back(str[i++]);
            }
        }
        while (n < arg.size())
            ret.push_back(arg[n++]);
        return ret;
    }
};